package com.tc.quartz.server.core;

import com.tc.quartz.server.core.bean.JobRunLogBean;
import org.quartz.JobExecutionContext;
import org.quartz.Trigger;

/**
 * quartz日志管理
 * @author yongjin.ye
 * 
 */
public interface IPaymentQuartzService {


	public static final String DICT_TYPE = "system";
	public static final String TRIGGER_NEXT_JOB = "TRIGGER_NEXT_JOB";

	public static final String TOKEN = "TOKEN";
	public static final String OPEN_API_URL = "open_api_url";
	public static final String OPEN_API_TOKEN = "open_api_token";
	
	
	/**
	 * 记录任务运行日志
	 * @param runLog
	 * @return
	 * @throws Exception
	 */
	public void insertJobRunLogOfTriggerMisfired(Trigger trigger) throws Exception;
	
	public long insertJobRunLog(JobExecutionContext context, long startTime) throws Exception;
	
	public long insertJobRunLog(JobExecutionContext context, long startTime, boolean isRepeated) throws Exception;

	public long insertJobRunLog(JobRunLogBean runlog) throws Exception;
	
	/**
	 * 任务运行结束后，修改运行状态和运行时间等信息
	 * @param runLog
	 * @return
	 * @throws Exception
	 */
	public int updateJobRunLog(long logId, String resultCode, String resultMsg, String remark, long endTime) ;
	
	/**
	 * 触发nextjob
	 * @param context
	 * @return
	 */
	public String triggerNextJob(JobExecutionContext context) throws Exception;
}
